package com.miyake.client.datamanage.plugin;

import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.VerticalPanel;
import com.google.gwt.user.client.ui.Widget;
import com.miyake.client.DataService;
import com.miyake.client.datamanage.AnalysisSetup;
import com.miyake.client.tools.OkCancelDialog;

public abstract class ReAnalyzeDialog extends OkCancelDialog {

	abstract protected String getPluginKey();
	abstract protected String getNodeKey();
	
	private AnalysisSetup analysisSetup;
	
	@Override
	protected Widget getContent() {
		VerticalPanel p = new VerticalPanel();
		getAnalysisParameter(getNodeKey(), getPluginKey(), p);
		return p;
	}

	protected void getAnalysisParameter(String nodeKey, String pluginKey, final VerticalPanel paramPanel) {
		DataService.Util.getInstance().getMyAnalysisParameters(nodeKey, pluginKey, new AsyncCallback<AnalysisSetup>() {

			@Override
			public void onFailure(Throwable caught) {
				// TODO Auto-generated method stub
				
			}

			@Override
			public void onSuccess(AnalysisSetup result) {
				analysisSetup = result;
				new AnalysisParameterPanel(result, paramPanel);
			}
			
		});
	}
	public AnalysisSetup getAnalysisSetup() {
		return analysisSetup;
	}
	
}
